home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / knowhow4 / sview.h < prev    next >
C/C++ Source or Header  |  1994-10-10  |  2KB  |  61 lines

  1. // This class works with text in memory
  2.  
  3. #ifndef __SCROLL_VIEW_H_
  4. #define __SCROLL_VIEW_H_
  5.  
  6. #include "simple.h"
  7. #include "showtext.h"
  8. #include "nret.h"
  9.  
  10. extern char* firstString(int first, char* string);
  11.  
  12.  
  13. class ScrollView : public ShowText
  14.     {
  15.     protected:
  16.     loc start;               // from top and left of text in memory, pseudotxt
  17.     loc pos;                 // from top and left of text on screen
  18.  
  19.     char* string;            // the string to view
  20.     loc scale;
  21.     int interval;
  22.     int direction;
  23.     rect bnd;              // visible area, screen coords
  24.     loc curs;              // cursor, pixels
  25.     char* findString;      // string to find;
  26.     int number_of_nl;      // nl's in the string
  27.     public:
  28.     ScrollView(loc start_pos, char* str,
  29.           rect b, loc sc = loc(1, 1), int interv = 15,
  30.           int dir = HORIZ_DIR);
  31.     void show(int first, int last = 0, int mode = COPY_PUT,
  32.           int shift = 0);
  33.     char* showString(char* str, loc scale, int mode);
  34.     int lineLen(int num);
  35.  
  36.     void showCursor();
  37.  
  38.     void hideCursor() { showCursor(); }
  39.     char* getLine(int n); // returns 0-terminated heap allocated string
  40.     int find(char* word);
  41.     int up(int jmp = 1);
  42.     int dn(int jmp = 1);
  43.     int left(int jmp = 1);
  44.     int right(int jmp = 1);
  45.     void home();
  46.     void end();
  47.     int pgUp();
  48.     int pgDn();
  49.     void toTop();
  50.     void toBottom();
  51.  
  52.  
  53.     void setStart(loc s) { start = s; }
  54.     void setPos(loc p) { pos = p; }
  55.     void setString(char* s) { string = s; }
  56.     void setScale(loc s) { scale = s; }
  57.     void setInterval(int interv) { interval = interv; }
  58.     void setDirection(int dir) { direction = dir; }
  59.     };
  60.  
  61. #endif __SCROLL_VIEW_H_